<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"
                xmlns:sf="http://www.springframework.org/tags/faces"
                xmlns:sec="http://www.springframework.org/security/facelets/tags"
                xmlns:spring="http://www.springframework.org/tags"
                xmlns:c="http://java.sun.com/jstl/core" 
				template="/WEB-INF/layouts/template.xhtml">

<ui:define name="main">
<script type="text/javascript">document.getElementById('doc3').className="yui-t6";</script>
<script type="text/javascript">document.getElementById('menuProjects').className="selected";</script>
<div id="yui-main">
	<div class="yui-b">
		<div id="wrapper" class="yui-u first">
			<h3 class="title">${msg.title_project_review} ${project.name}</h3>
			<div id="mainContent">
				<h2>${msg.categories}</h2>
				<h:outputText value="${msg.project_noCategories}" rendered="${categories.rowCount == 0}"/>
				<h:form id="categories">
					<h:dataTable id="categories" styleClass="summary" value="${categories}" var="cat" rendered="${categories.rowCount > 0}"> 
						<h:column >
					    	<f:facet name="header">${msg.name}</f:facet>
					    	<sf:commandLink id="viewCategoryLink" action="select">${cat.name}</sf:commandLink>
					    </h:column>
					    <h:column >
					    	<f:facet name="header">${msg.description}</f:facet>
					    	${cat.description}
					    </h:column>
					</h:dataTable>
					<h:panelGroup rendered="${!project.retired}">
						<sec:ifAnyGranted roles="ROLE_ADMIN">
							<div>
								<sf:commandLink id="add" action="add"><div class="button">${msg.add} ${msg.category}</div></sf:commandLink>
							</div>
						</sec:ifAnyGranted>
					</h:panelGroup>
				</h:form>
				<h:form id="announcements"  rendered="${!project.retired}">
				    <sec:ifAnyGranted roles="ROLE_ADMIN">
						<div>
							<sf:commandLink id="addAnnouncement" action="addAnnouncement"><div class="button">${msg.add} ${msg.announcement}</div></sf:commandLink>
						</div>
					</sec:ifAnyGranted>
				</h:form>
			</div>
		</div> 
    </div>	
</div>
<div class="yui-b">
	<h3 class="title">${project.name}</h3>
	<div class="wrapper">
		<h:form>
			<h:panelGroup rendered="${!(empty project.description)}">
				<div class="field">
					<h:outputText value="${msg.description}: ${project.description}" />
				</div>
			</h:panelGroup>
			<h:panelGroup rendered="${!(project.client eq null)}">
				<div class="field">
					<div class="label">${msg.client}</div>
					<div class="output"><sf:commandLink id="reviewClient" value="${project.client.name}" action="reviewClient" /></div>
				</div>
			</h:panelGroup>
			<h:panelGroup rendered="${!(empty project.hours or project.hours eq 0)}">
				<div class="field">
					<div class="label">${msg.hours}</div>
					<div class="output">${project.hours}</div>
				</div>
			</h:panelGroup>
			<h:panelGroup rendered="${!(empty project.assignedMembers)}">
				<h4>${msg.assignedMembers}</h4>
				<c:forEach items="${project.assignedMembers}" var="am">
					<div class="field">${am.contact.name}</div>
				</c:forEach>
			</h:panelGroup>
			<c:if test="${project.retired}">
				<h3>${msg.retired}</h3>
			</c:if>
			<div style="clear: both; height: 5px;" />
			<div>
				<sec:ifAnyGranted roles="ROLE_ADMIN">
					<sf:commandLink id="edit" action="edit"><div class="button">${msg.edit}</div></sf:commandLink>
					<sf:commandLink id="delete" action="delete"><div class="button">${msg.delete}</div></sf:commandLink>
				</sec:ifAnyGranted>
			</div>
		</h:form>
	</div>
</div>
<div style="clear: both; height: 5px;" />
<h:form><sf:commandLink id="back" action="back"><div class="button">${msg.back} ${msg.title_project}</div></sf:commandLink></h:form>
</ui:define>
</ui:composition>